//
// Created by ChaoDONG on 2021-03-17.
//

/* praise2.c */

// try the %u or %lu specifiers if your implementation

// does not recognize the %zd specifier

#include <stdio.h>

#include <string.h> /* provides strlen() prototype */

#define PRAISE "You are an extraordinary being."

int main(void)
{
    char name[40];

    printf("What's your name? \n");

    scanf("%s", name);

    printf("Hello, %s. %s\n", name, PRAISE);

    printf("Your name of %zd letters occupies %zd memory cells.\n",
           strlen(name), sizeof(name));

    printf("The phrase of praise has %zd letters and occupies %zd memory cells.\n",
           strlen(PRAISE),sizeof(PRAISE));

    /* 对于 PRAISE，用 strlen()得出的也是字符串中的字符数（包括空格和标点符号）
     * sizeof运算符给出的数更大，因为它把字符串末尾不可见的空字符也计算在内。*/

    return 0;
}